//
//  SignUpVC.m
//  doubleEduStudents
//
//  Created by 盛洋 on 2021/1/12.
//  Copyright © 2021 shengYang. All rights reserved.
//

#import "SignUpVC.h"
#import "SYButton.h"
#import "signUpCollectionCell.h"
#import "SignUPInforVC.h"

@interface SignUpVC ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (strong, nonatomic) IBOutlet UICollectionView *collection_view;
@property (strong, nonatomic) IBOutlet SYButton *system_btn;
@property (strong, nonatomic) IBOutlet SYButton *activity_btn;
@property (strong, nonatomic) IBOutlet UILabel *zhuangtai_lab;

@property (strong, nonatomic) IBOutlet SYButton *all_btn;
@property (strong, nonatomic) IBOutlet SYButton *sign_btn;
@property (strong, nonatomic) IBOutlet SYButton *praise_btn;
@property (strong, nonatomic) IBOutlet SYButton *end_btn;

@end

@implementation SignUpVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的报名";
    self.system_btn.isChoose = self.all_btn.isChoose = YES;
    self.activity_btn.isChoose = self.sign_btn.isChoose = self.praise_btn.isChoose = self.end_btn.isChoose = NO;

    [self.collection_view registerNib:[UINib nibWithNibName:@"signUpCollectionCell" bundle:nil] forCellWithReuseIdentifier:@"signUpCollectionCell"];
        self.collection_view.delegate = self;
        self.collection_view.dataSource = self;
        self.collection_view.showsVerticalScrollIndicator = NO;//隐藏竖滚动条
        self.collection_view.pagingEnabled = NO;
    
    
//    self.system_btn.titleLabel.font = self.activity_btn.titleLabel.font = self.all_btn.titleLabel.font = self.sign_btn.titleLabel.font = self.praise_btn.titleLabel.font = self.end_btn.titleLabel.font = self.zhuangtai_lab.font = AutoLabFont3;
    
    [self.system_btn addTarget:self action:@selector(chooseSystem) forControlEvents:UIControlEventTouchUpInside];
    [self.activity_btn addTarget:self action:@selector(chooseActivity) forControlEvents:UIControlEventTouchUpInside];
    
    [self.all_btn addTarget:self action:@selector(chooseAll) forControlEvents:UIControlEventTouchUpInside];
    [self.sign_btn addTarget:self action:@selector(chooseSign) forControlEvents:UIControlEventTouchUpInside];
    [self.praise_btn addTarget:self action:@selector(choosePraise) forControlEvents:UIControlEventTouchUpInside];
    [self.end_btn addTarget:self action:@selector(chooseEnd) forControlEvents:UIControlEventTouchUpInside];
}

#pragma mark ----- collectionViewDataSource
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 15;
}

//每个item的大小
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    return CGSizeMake((SCREEN_W - 100)/3, SCREEN_H * 0.6);
}

//cell
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    signUpCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"signUpCollectionCell" forIndexPath:indexPath];
    return cell;
}

//列间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 20;
}
//行间距（同一行的cell的间距）
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}

//四周边距
//- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
//    return UIEdgeInsetsMake(0, 30, 0, 0);
//}

//点击比赛
-(void)chooseSystem{
    self.system_btn.isChoose = YES;
    self.activity_btn.isChoose = NO;
}

//点击活动
-(void)chooseActivity{
    self.activity_btn.isChoose = YES;
    self.system_btn.isChoose = NO;
}

//点击全部
-(void)chooseAll{
    self.all_btn.isChoose = YES;
    self.sign_btn.isChoose = NO;
    self.praise_btn.isChoose = NO;
    self.end_btn.isChoose = NO;
}

//点击报名中
-(void)chooseSign{
    self.all_btn.isChoose = NO;
    self.sign_btn.isChoose = YES;
    self.praise_btn.isChoose = NO;
    self.end_btn.isChoose = NO;
}

//点击评奖中
-(void)choosePraise{
    self.all_btn.isChoose = NO;
    self.sign_btn.isChoose = NO;
    self.praise_btn.isChoose = YES;
    self.end_btn.isChoose = NO;
}

//点击已结束
-(void)chooseEnd{
    self.all_btn.isChoose = NO;
    self.sign_btn.isChoose = NO;
    self.praise_btn.isChoose = NO;
    self.end_btn.isChoose = YES;
}

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    SignUPInforVC *vc = [[SignUPInforVC alloc]init];
    [self PushToViewController:vc];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
